package com.zyjc.city.controller;

import com.zyjc.city.model.Result;
import com.zyjc.city.model.dto.TransportDto;
import com.zyjc.city.model.params.AreaPersonIn;
import com.zyjc.city.model.params.TransportIn;
import com.zyjc.city.service.AreaPersonService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * @author ckj
 * @date 2024年04月02日 10:04
 */
@RestController
@RequestMapping("/screen")
public class ScreenController {
    @Autowired
    private AreaPersonService areaPersonService;

    @ApiOperation("获取区域实时人数")
    @PostMapping("/getAreaData")
    public Result<TransportDto> getAreaData(@Valid @RequestBody TransportIn transportIn){
        TransportDto data = areaPersonService.getData(transportIn);
        return Result.ok(data);
    }
    @ApiOperation("保存区域数据")
    @PostMapping("/saveAreaData")
    public Result saveAreaData(@Valid @RequestBody AreaPersonIn areaPersonIn){
        areaPersonService.getAreaPerson(areaPersonIn);
        return Result.ok();
    }
}
